package com.database.connection;

import java.sql.*;

public class DatabaseConnection {
	private static final String url;
	private static final String userId;
	private static final String password;
	static {
		url = "jdbc:mysql://localhost:3306/finalservletandjsp";
		userId = "root";
		password = "root";
	}
	public static Connection getConnection() {
		Connection conn = null;
		try {
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection(url, userId, password);
			return conn;
		} catch (ClassNotFoundException ce) {
			System.out.println(ce);
		} catch (SQLException se) {
			System.out.println(se);
		}
		return conn;
	}
}
